﻿using Simple.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

/*********************************************************
 * 命名空间 Simple.Framework.Configuration
 * 接口名称 ClientConfiguration
 * 开发人员：ADMIN
 * 创建时间：2023/12/29 14:20:21
 * 描述说明：
 * 更改历史：
 * 
 * *******************************************************/
namespace Simple.Framework.Configuration
{
	public class ClientConfiguration
	{
		public ClientConfiguration() { }

		private int serverPort;

		private IPAddress iPAddress;

		private SocketType socketType;
		private ProtocolType protocolType;

		public IPAddress GetServer()
		{
			return iPAddress;
		}


        public int ServerPort { get { return serverPort; } set { serverPort = value; } }
        public string ServerAddress { get { return iPAddress.ToString(); } set {

				if (ToolSimpleCheck.IsNullOrEmpty(value) || value=="localhost")
				{
					iPAddress=ToolSimpleCheck.GetLocalHostFirstOrDefault();
				}
				else
				{
				    IPAddress.TryParse(value,out iPAddress);
				} } }


		public SocketType SocketType { get { return socketType; } set { socketType = value; } }
		public ProtocolType ProtocolType { get { return protocolType; } set { protocolType = value; } }


	}
}
